Entities often need to access one or more resources or artifacts to perform work in a computing system. Examples of such entities include users, applications, processes, tasks, and threads. At any moment in time, there may be any number of concurrent entities that seek to access the resources in a system. However, conflicts may arise if multiple entities are permitted to perform incompatible accesses to the same resources at the same time.
To prevent conflicts from occurring, mechanisms may be implemented to manage the type, number, and/or ordering of accesses that are permitted to resources in the system. A common mechanism that is used to synchronize and manage access to resources in computing and database systems is referred to as a “lock”. A lock is a data structure that indicates whether or which particular entities have been granted rights to a resource. An entity must acquire a lock to a resource before the entity is permitted to access the resource. The scope of possessory or access rights granted to an entity for a particular resource is often related to the type of work that the entity intends to perform upon that resource. For example, an “exclusive lock” could be granted to an entity that seeks to access a data item in a way that is incompatible with concurrent access by other entities, e.g., to modify, write or delete the data item. The exclusive lock therefore grants exclusive access to the data item, which prevents other entities from being able to concurrently access the same data item at the same time. This type of lock essentially serializes access to its corresponding resource. A “shared lock” could be granted if an entity wishes to perform activities upon a resource which can also be concurrently performed with activities by other entities upon the same resource without introducing conflicts or inconsistencies to the data, e.g., to read a data item. Therefore, the shared lock can be concurrently granted to multiple entities for the same resource at the same time. Depending upon the exact configuration of the computing or database system, other types of locks and lock scopes can be implemented to manage access to data.
In a collaboration environment where multiple users are actively creating and modifying artifacts/resources in a highly concurrent manner, the mechanism of locking provides a valuable way to ensure that changes from one user are not overwritten by another user inadvertently.
The issue addressed by the present invention relates to locking of resources that fit within a hierarchical structure, where nodes in the hierarchical structure may have parent or child nodes. The root node has zero parent nodes, while child nodes will have at least one parent node. There may be entire chains of multi-level relationships in the hierarchy as each node may have descendents nodes that themselves have their own descendent nodes.
Consider the example hierarchical structure of FIG. 1, which includes a root node A1 having zero parent nodes, but having three direct child nodes B1, B2, and B3. Node B1 has its own direct child nodes C1 and C2. C1 has direct child nodes D1 and D2. In this example, A1 is an “ancestor” to all other nodes in the hierarchy. B1 is an ancestor to nodes C1, C2, D1, and D2. C1 is an ancestor to nodes D1 and D2.
A real-world example of such a hierarchical structure would be a file system with a folder hierarchy, where parent nodes correspond to directories and leaf nodes correspond to either files or directories. For example, D1 and D2 may correspond to files in a file system, with C1 being a directory that includes files D1 and D2. B1 is a directory that includes directory C1, and A1 correspond to a root directory that includes subdirectory B1.
With hierarchical structures, locking is often intended to have effects that transcend multiple hierarchical levels. For example, a lock on a parent node may have the effect of locking its descendent nodes.
Many content management systems and collaboration systems provide locking of artifacts and resources for hierarchical structures. However, conventional systems are limited in that they provide locking support only for leaf nodes in the hierarchical structure. For instance, in a content management system, locking support is provided for individual documents, but not for folders. This is fairly limiting in scenarios where users want to operate on the entire folder, e.g., to perform activities such as re-organizing content or populating large amounts of content in a given folder.
The invention is directed to an improved approach for handling locks and locking for hierarchical structures. Some embodiments of the present invention present a method, system, and computer program product for efficiently capturing lock information for hierarchical nodes as well as for the enforcement of derived locks. Support is provided for locking of leaf nodes as well as for locking of intermediate nodes.
Further details of aspects, objects, and advantages of the invention are described below in the detailed description, drawings, and claims. Both the foregoing general description and the following detailed description are exemplary and explanatory, and are not intended to be limiting as to the scope of the invention.